/*
 * RelayContainer.h
 *
 *  Created on: 2012. 11. 14.
 *      Author: dalxx
 */


#ifndef RELAYCONTAINER_H_
#define RELAYCONTAINER_H_
#include <Arduino.h>
#include "PLCConfig.h"
#include "Relay.h"
#include "RelayDI.h"
#include "RelayDL.h"
#include "RelayAI.h"
#include "RelayTimer.h"
#include "Output.h"
namespace PLCLib {



class RelayContainer
{
private:
	Relay relayList[MAX_RELAYSIZE];
	int numRelay;

	RelayDI DI;
	RelayDL DL;
	RelayAI AI;
	RelayTimer TM;
	OutputList Out;
	static char* buffer;
	static int bufSize;

public:
	RelayContainer();
	Relay* findRelay(int num);
	void init(StringStream& stream);
	void update();
	Relay* getRelayList(int& nRelay );

protected:
	void readDI(int index, Stream& stream);
	void readAI(int index, Stream& stream);
	//void readDL(int index, Stream& stream);
	//void readTM(int index, Stream& stream);
	void readOut(int index, Stream& stream);

public:
	static void setBuffer(char* buf, int size);






};
} /* namespace PLCLib */
#endif /* RELAYCONTAINER_H_ */
